﻿@model AffiliationModel
@{
    var (mode, title, ro) = !Model.Id.HasValue
        ? ("Add", "Add affiliation", "")
        : ("Edit", $"Edit affiliation {Model.Id}", "readonly");
    ViewData["Title"] = title;
}

<h2 class="mt-2">@ViewData["Title"]</h2>

<div class="row">
    <div class="col-lg-4">
        <form asp-action="@mode" method="post" enctype="multipart/form-data">
            <div class="form-group">
                <label asp-for="Id" class="required"></label>
                <input asp-show-if="!Model.Id.HasValue" asp-for="Id" required class="form-control" />
                <input asp-show-if="Model.Id.HasValue" asp-for="Id" readonly required class="form-control" />
            </div>
            <div class="form-group">
                <label asp-for="Abbreviation" class="required"></label>
                <input asp-for="Abbreviation" required maxlength="10" class="form-control" />
                <label asp-for="Abbreviation"><small class="text-muted">If this field is modified while student module is enabled, this will cause data error.</small></label>
            </div>
            <div class="form-group">
                <label asp-for="Name" class="required"></label>
                <input asp-for="Name" required maxlength="20" class="form-control" />
            </div>
            <div class="form-group">
                <label asp-for="CountryCode"></label>
                <select asp-for="CountryCode" class="form-control" asp-items="TenantDefaults.Countries.Select(k => new SelectListItem(k.Value, k.Key))">
                    <option value="">(not specified)</option>
                </select>
            </div>
            <div class="form-group">
                <label asp-for="EmailSuffix"></label>
                <input asp-for="EmailSuffix" maxlength="20" class="form-control" />
                <label asp-for="EmailSuffix"><small class="text-muted">If the student verify is allowed, please fill this field with the student email suffix like <code>@@mails.xxu.edu.cn</code>.</small></label>
            </div>
            <div class="form-group">
                <label asp-for="Logo" class="required"></label>
                <div class="custom-file">
                    <input asp-for="Logo" type="file" accept="image/png" class="custom-file-input" />
                    <label for="Logo" class="custom-file-label"></label>
                </div>
            </div>
            <div class="form-group">
                <button type="submit" class="btn-primary btn">Save</button>
            </div>
        </form>
    </div>
</div>
